package com.whutosa.template.server.config;

import com.whutosa.template.server.interceptor.AddFieldInterceptor;
import com.whutosa.template.server.interceptor.CrossFieldInterceptor;
import com.whutosa.template.server.interceptor.TemplateInterceptor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by 19110 on 2016/9/16.
 */
@Configuration
public class BeansInitializer {
    private static final Logger log = LogManager.getRootLogger();

    /**
     * 属性注入测试
     */
    @Value("${com.whutosa.server.template.testProp}")
    private String testProp;

    @Bean
    public TemplateInterceptor templateInterceptor() {
        log.debug("属性注入测试" + testProp);//属性注入测试
        return new TemplateInterceptor();
    }

    @Bean
    public CrossFieldInterceptor crossFieldInterceptor() {
        return new CrossFieldInterceptor();
    }

    @Bean
    public AddFieldInterceptor addFieldInterceptor() {
        return new AddFieldInterceptor();
    }

}
